package com.csk.zsk.compents.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.csk.zsk.compents.dao.CommentDao;
import com.csk.zsk.compents.entity.Comment;
import com.csk.zsk.compents.service.CommentService;

@Service
@Transactional
public class CommentServiceImpl implements CommentService {

	@Autowired
	private CommentDao commentDao;

	@Override
	public void saveComment(Comment comment) {
		commentDao.save(comment);

	}

	@Override
	public void deleteComment(String id) {
		commentDao.delete(id);

	}

	@Override
	@Transactional(readOnly = true)
	public List<Comment> getCommentByUserId(String userId) {
		return commentDao.findBy("userid", userId);

	}

	@Override
	@Transactional(readOnly = true)
	public List<Comment> getCommentByObjId(String objId) {
		return commentDao.findBy("objid", objId);

	}

	@Override
	public List<Comment> getSubCommentListById(String commentid) {
		return commentDao.getSubCommentListById(commentid);
	}

	@Override
	public List<Comment> getCommentListByOjbid(String objid, boolean hasSub) {
		return commentDao.getCommentListByOjbid(objid, hasSub);
	}

}
